package Effect
{
	import flash.display.Sprite;
	
	public class CEffectManager
	{
		private var m_sprite :Sprite;
		private var m_bIsOnEffect_ShowTime :Boolean;
		private var m_Effect_ShowTime :CEffect_ShowTime;
		private var m_Effect_CPFUpgrade :CMC_CPFEffect_Upgrade;
		
		public function get sprite() :Sprite { return m_sprite; }
		
		public function CEffectManager()
		{
			m_sprite = new Sprite();
			m_bIsOnEffect_ShowTime = false;
			m_Effect_ShowTime = new CEffect_ShowTime();
			m_Effect_CPFUpgrade = null;
		}
		public function Update(tick :Number) :void
		{
			if (m_Effect_CPFUpgrade != null)
			{
				m_Effect_CPFUpgrade.alpha = 1.0 - Number(m_Effect_CPFUpgrade.currentFrame/32);
				if (m_Effect_CPFUpgrade.currentFrame == 32)
				{
					m_sprite.removeChild(m_Effect_CPFUpgrade);
					m_Effect_CPFUpgrade = null;
				}
			}
		}
		public function AddShowTimeEffectToSnake(spriteSnake :Sprite) :void
		{
			if (m_bIsOnEffect_ShowTime == true) return;
			m_bIsOnEffect_ShowTime = true;
			spriteSnake.addChild(m_Effect_ShowTime.sprite);
		}
		public function RemoveShowTimeEffectToSnake(spriteSnake :Sprite) :void
		{
			if (m_bIsOnEffect_ShowTime == false) return;
			m_bIsOnEffect_ShowTime = false;
			spriteSnake.removeChild(m_Effect_ShowTime.sprite);
		}
		
		public function CreateEffect_CPFUpgrade() :void
		{
			if (m_Effect_CPFUpgrade != null)
			{
				m_Effect_CPFUpgrade.gotoAndPlay(1);
			}
			else
			{
				m_Effect_CPFUpgrade = new CMC_CPFEffect_Upgrade();
				m_sprite.addChild(m_Effect_CPFUpgrade);
				m_Effect_CPFUpgrade.x = 507;
				m_Effect_CPFUpgrade.y = 412;
			}
		}

	}
}
